package org.groovymud.shell.security.callbacks;

import org.groovymud.shell.io.TerminalIO;

import javax.security.auth.callback.TextOutputCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
import java.io.IOException;
import java.util.Map;

public class SelfHandlingTextOutputCallback extends TextOutputCallback implements SelfHandlingCallback{
    public SelfHandlingTextOutputCallback(int messageType, String message) {
        super(messageType, message);
    }

    public void handle(TerminalIO terminalIO, Map<String, Object> callbackData) throws IOException, UnsupportedCallbackException {
        terminalIO.writeln(getMessage());
        terminalIO.flush();
    }
}
